﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Input;
using Microsoft.Practices.Composite.Presentation.Commands;
using BlueMarble.Genesis.Infrastructure.Interfaces;
using Microsoft.Practices.Composite.Events;

namespace BlueMarble.Genesis.Security.Membership
{
    public class MembershipViewModel : IMembershipViewModel, INotifyPropertyChanged
    {
        protected IEventAggregator eventAggregator;

        protected BlueMarble.Genesis.Infrastructure.Security.Membership membership;

        public MembershipViewModel(IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler Handler = PropertyChanged;
            if (Handler != null) Handler(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion

        #region IMembershipViewModel Members

        public void IsCurrentUserInRole(string Role)
        {
            membership.IsCurrentUserInRole(Role);
        }

        public void GetRolesForCurrentUser()
        {
            membership.GetRolesForCurrentUser();
        }

        #endregion
    }
}
